﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package org.aswing.skinbuilder {
    import flash.display.*;
    import org.aswing.*;
    import org.aswing.geom.*;
    import org.aswing.plaf.*;
    import org.aswing.graphics.*;

    public class SkinButtonBackground extends DefaultsDecoratorBase implements GroundDecorator, UIResource {

        protected var stateAsset:ButtonStateObject;
        protected var setuped:Boolean;
        protected var fixedPrefix:String;

        public function SkinButtonBackground(_arg1:String=null){
            this.setuped = false;
            this.fixedPrefix = _arg1;
            this.stateAsset = new ButtonStateObject();
        }
        public function getStateAsset():ButtonStateObject{
            return (this.stateAsset);
        }
        protected function getPropertyPrefix():String{
            if (this.fixedPrefix != null){
                return (this.fixedPrefix);
            };
            return ("Button.");
        }
        protected function setupAssets(_arg1:ComponentUI):void{
            this.stateAsset.setDefaultButtonImage(this.getAsset(_arg1, "DefaultButton.defaultImage"));
            this.stateAsset.setDefaultImage(this.getAsset(_arg1, "defaultImage"));
            this.stateAsset.setPressedImage(this.getAsset(_arg1, "pressedImage"));
            this.stateAsset.setPressedSelectedImage(this.getAsset(_arg1, "pressedSelectedImage"));
            this.stateAsset.setDisabledImage(this.getAsset(_arg1, "disabledImage"));
            this.stateAsset.setSelectedImage(this.getAsset(_arg1, "selectedImage"));
            this.stateAsset.setDisabledSelectedImage(this.getAsset(_arg1, "disabledSelectedImage"));
            this.stateAsset.setRolloverImage(this.getAsset(_arg1, "rolloverImage"));
            this.stateAsset.setRolloverSelectedImage(this.getAsset(_arg1, "rolloverSelectedImage"));
        }
        private function getAsset(_arg1:ComponentUI, _arg2:String):DisplayObject{
            var _local3:String = this.getPropertyPrefix();
            return ((_arg1.getInstance((_local3 + _arg2)) as DisplayObject));
        }
        public function getDisplay(_arg1:Component):DisplayObject{
            return (this.stateAsset);
        }
        public function updateDecorator(_arg1:Component, _arg2:Graphics2D, _arg3:IntRectangle):void{
            if (!this.setuped){
                this.setupAssets(getDefaultsOwner(_arg1));
                this.setuped = true;
            };
            var _local4:AbstractButton = AbstractButton(_arg1);
            var _local5:ButtonModel = _local4.getModel();
            this.stateAsset.setEnabled(_local5.isEnabled());
            this.stateAsset.setPressed(((_local5.isPressed()) && (_local5.isArmed())));
            this.stateAsset.setSelected(_local5.isSelected());
            this.stateAsset.setRollovered(((_local4.isRollOverEnabled()) && (_local5.isRollOver())));
            this.stateAsset.setDefaultButton((((_local4 is JButton)) && (JButton(_local4).isDefaultButton())));
            this.stateAsset.updateRepresent(_arg3);
        }

    }
}//package org.aswing.skinbuilder 
